

	**** bring in w-nominate scalings		
	clear
	gen state = ""
	save ../data_output/tmp_ideal, replace
	local files : dir "../data_input/ideal/" files "*.csv"
	
	foreach file in `files' {
		dis "`file'"
project, original("../data_input/ideal/`file'")		
		insheet using "../data_input/ideal/`file'", clear
		drop v1
		replace state = substr("`file'", 1, 2)
		cap gen wnom = real(idealpoints)
		if _rc {
			rename idealpoints wnom
		}
		else {
			drop idealpoints
		}
	
		append using ../data_output/tmp_ideal, force
		save ../data_output/tmp_ideal, replace
	}
	
	replace state = "CA" if state == "ca"
	rename candid CandId
	
	gen abs_wnom = abs(wnom)
	
	save ../data_output/idealpoints.dta, replace
project, creates(../data_output/idealpoints.dta)
